package tg.app.rj.payreqw;

import java.rmi.RemoteException;
import java.util.Date;
import psdi.mbo.StatefulMbo;
import psdi.mbo.StatusHandler;
import psdi.util.MXApplicationException;
import psdi.util.MXException;

/***
 * 
 * @author pzx
 * 
 */
public class PayreqwwStatusHandler extends StatusHandler {
	private StatefulMbo parent;

	public PayreqwwStatusHandler(StatefulMbo mbo) {
		super(mbo);
		this.parent = null;
		this.parent = mbo;
	}

	public void changeStatus(String s, String s1, Date date, String s2)
			throws MXException, RemoteException {
		if ((!this.parent.isNull("statusdate")) && (date.getTime() < this.parent.getDate("statusdate").getTime())) {
			throw new MXApplicationException("状态更改出错", "时间不正确");
		}
		this.parent.setValue("status", s1, 2L);
		this.parent.setValue("statusdate", date, 2L);
	}

	public void checkStatusChangeAuthorization(String s1) throws MXException,
			RemoteException {
	}

	public void canChangeStatus(String s, String s1, long l)
			throws MXException, RemoteException {
		if (s.equalsIgnoreCase(s1)) {
			throw new MXApplicationException("状态更改出错", "无效状态");
		}
	}
}